Remove dead code in preferredProvider fallback chain#1154
Closed
cursor[bot] wants to merge 1 commit intocodething/648ca884-claudefrom
Closed
Remove dead code in preferredProvider fallback chain#1154cursor[bot] wants to merge 1 commit intocodething/648ca884-claudefrom
cursor[bot] wants to merge 1 commit intocodething/648ca884-claudefrom
Conversation
The middle operand `options?.provider` in the nullish coalescing chain `currentProvider ?? options?.provider ?? threadProvider` is dead code. The validation guard at lines 215-221 already ensures options.provider equals threadProvider when defined, so it can never produce a different value. Simplified to `currentProvider ?? threadProvider`. Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Removes dead code in the
preferredProviderfallback chain inProviderCommandReactor.ts.Problem
The expression
currentProvider ?? options?.provider ?? threadProvidercontained a dead middle operand. The validation guard at lines 215–221 already ensures that ifoptions.provideris defined, it must equalthreadProvider. Therefore,options?.providercan never produce a value different fromthreadProvider, making it misleading dead code that could confuse future contributors into thinking explicit provider selection influences session routing.Fix
Simplified the expression to
currentProvider ?? threadProvider, which is behaviorally identical but accurately reflects the actual fallback logic.Note
Remove
options?.providerfromProviderCommandReactorpreferredProvider fallback chainIn ProviderCommandReactor.ts, the start handler previously resolved
preferredProviderascurrentProvider ?? options?.provider ?? threadProvider. The middle term is removed, sooptions.provideris no longer consulted. Behavioral Change: callers passingoptions.providerwill have it silently ignored; onlycurrentProviderandthreadProviderare used.Macroscope summarized a98a939.